import {MainData, PK, pkType} from "../../coreModule/data/BaseData";
import {field} from "../../coreModule/data/DataLoader";
import {ParticRecordStatus} from "./ParticRecord";

export enum CollectRecordStatus {
    Normal, Exit
}

export enum CollectRecordType {
    Military, Reward, PartTime, Camp
}

export class CollectRecord extends MainData {

    @field(pkType())
    public userId: PK;
    @field(pkType())
    public taskId: PK;

    @field(Number)
    public status: CollectRecordStatus = CollectRecordStatus.Normal;
    @field(Number)
    public createdAt: number;

    @field(String)
    public nickName: string;
    @field(String)
    public displayName: string;
    @field(String)
    public avatarUrl: string;

    /**
     * 创建
     */
    public static create(userId, taskId) {
        const res = new CollectRecord();
        res.taskId = taskId;
        res.userId = userId;
        res.status = CollectRecordStatus.Exit;

        res.createdAt = Date.now();
        return res;
    }
}
